package com.easygo.goods.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.easygo.goods.service.GoodsService;
import com.easygo.goods.service.ItemCatService;
import com.easygo.pojo.Goods;
import com.easygo.pojo.ItemCat;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 徐策
 * @date 2020/1/4 15:15
 */
@RestController
@Scope("prototype")
public class GoodsController {
    @Resource
    GoodsService goodsService;
    /**
     * 01-全部查询商品
     * @return
     */
    @GetMapping("/goods_list/{category1Id}")
    public List<Goods> getGoodsByCategory1Id(@PathVariable Long category1Id){
        return goodsService.list(new QueryWrapper<Goods>()
                .eq("category1_Id",category1Id)
                .eq("is_delete",0)
                .eq("is_marketable",1)
                .orderByDesc("id")
                .last("limit 0,6"));
    }





}
